<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMenuTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('menu', function (Blueprint $table) {
            $table->increments('id')->comment('自增ID');
            $table->tinyInteger('type')->default(1)->comment('菜单类型：1目录、2菜单、3链接');
            $table->unsignedInteger('parent_id')->default('0')->comment('上级菜单');
            $table->string('name', 50)->default('')->comment('菜单名称');
            $table->string('enname', 100)->default('')->comment('英文名称');
            $table->string('description', 200)->default('')->comment('菜单描述');
            $table->unsignedInteger('sort')->default('999')->comment('排序位置');
            $table->string('route_name', 50)->default('')->comment('路由名称');
            $table->string('route_icon', 50)->default('')->comment('菜单图标');
            $table->string('route_path')->default('')->comment('路由地址或网址（网址须以http://或https://开头）');
            $table->string('route_component', 100)->default('')->comment('页面组件');
            $table->string('route_redirect', 100)->default('')->comment('重定向地址');
            $table->string('route_activeMenu', 100)->default('')->comment('高亮路由地址');
            $table->tinyInteger('route_alwaysShow')->default(0)->comment('总显示根路由，1是 0否 默认0');
            $table->tinyInteger('route_affix')->default(0)->comment('是否固定在标签栏上，1固定  0不固定，默认0');
            $table->tinyInteger('route_breadcrumb')->default(1)->comment('面包屑，1 显示  0隐藏，默认1');
            $table->tinyInteger('route_isTree')->default(0)->comment('菜单树，1是 0否，默认0');
            $table->unsignedTinyInteger('relation_cate')->default('0')->comment('绑定栏目0否1是');
            $table->tinyInteger('status')->default(1)->comment('发布状态，0隐藏，1显示');
            $table->integer('created_user_id')->default(0)->comment('管理员ID');
            $table->timestamp('created_at')->nullable()->comment('创建时间');
            $table->timestamp('updated_at')->nullable()->comment('更新时间');
            $table->softDeletes()->comment('删除时间');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('menu');
    }
}
